﻿@page
@model AdminUI.Pages.SysManage.MenuEditModel
@{
    var F = Html.F();
}

@section body{

    <f:Form ID="Form1" ShowBorder="false" ShowHeader="false" AutoScroll="true" BodyPadding="15" IsViewPort="true">
        <Rows>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:TextBox ID="MenuID" Required="true" Label="菜单ID" Readonly="true" Text="@Model.Current.MenuID"></f:TextBox>
                    <f:TextBox ID="MenuName" Required="true" Label="菜单名称" EmptyText="请输入菜单名称" Text="@Model.Current.MenuName"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:TriggerBox ID="ParentName" Label="上级菜单" Readonly="false" TriggerIcon="Search" Text="@Model.ParentName"
                                  OnClientTriggerClick="onSelectMenu();" EmptyText="0-顶层菜单" EnableClickAction="false">
                    </f:TriggerBox>
                    <f:HiddenField ID="ParentID" Text="@Model.Current.ParentID"></f:HiddenField>
                    <f:CheckBox ID="IsEnable" Text="是否启用" Checked="@Model.Current.IsEnable"></f:CheckBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="50% 50%">
                <Items>
                    <f:TriggerBox ID="Icon" Label="图标" Readonly="false" TriggerIcon="Search" Text="@Model.Current.Icon"
                                  OnClientTriggerClick="onSelectIcon();" EmptyText="请选择菜单图标" EnableClickAction="false">
                    </f:TriggerBox>
                    <f:NumberBox ID="SortFlag" EmptyText="请输入排序标志" Label="排序标志" Text="@Model.Current.SortFlag" Required="true" Increment="1"></f:NumberBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:TextBox ID="Url" Required="false" Label="菜单Url" EmptyText="请输入菜单Url" Text="@Model.Current.Url"></f:TextBox>
                </Items>
            </f:FormRow>
            <f:FormRow ColumnWidths="100%">
                <Items>
                    <f:TextArea ID="Memo" EmptyText="请输入内容" Label="备注" AutoGrowHeight="true" Text="@Model.Current.Memo" AutoGrowHeightMin="200" AutoGrowHeightMax="600"></f:TextArea>
                </Items>
            </f:FormRow>
        </Rows>
        <Toolbars>
            <f:Toolbar ID="Toolbar1" Position="Top" ToolbarAlign="Left">
                <Items>
                    <f:Button ID="btnClose" Text="关闭" Icon="Cross" IconFont="Close" OnClientClick="F.activeWindow.hide();"></f:Button>
                    <f:Button ID="btnReset" Text="重置" Icon="ArrowUndo" OnClientClick="F.ui.Form1.reset();"></f:Button>
                    <f:Button ID="btnSubmit" Text="保存" Icon="SystemSave" OnClick="@Url.Handler("btnSubmit_Click")" _ValidateForms="Form1" OnClickFields="Form1"></f:Button>
                </Items>
            </f:Toolbar>
        </Toolbars>
    </f:Form>
    <f:Window ID="Window1" IsModal="true" Hidden="true" Target="Top" EnableResize="true"
              EnableMaximize="true" EnableIFrame="true" Width="670" Height="480"
              OnClose="@Url.Handler("Grid_DoAction")" OnCloseFields="RegionPanel1">
    </f:Window>

}

@section script {

    <script>
        function onSelectMenu(event) {
            var path = "/Dialog/SelectMenu?t=@Model.Current.MenuType";
            //alert(path);
            F.ui.Window1.show(path, '选择上级菜单（双击选择）', 400, 500);
        }

        function onSelectIcon(event) {
            var path = "/Dialog/SelectIconFont";
            //alert(path);
            F.ui.Window1.show(path, '选择图标字体');
        }

        function updateIconFontValue(iconClass) {
            F.ui.Icon.setText(iconClass);
            //alert("已选择图标字体样式：" + iconClass);
        }

        function updateTreeSelectValue(treeNode) {
            F.ui.ParentName.setText(treeNode.id + '-' + treeNode.text);
            F.ui.ParentID.setValue(treeNode.id);
        }

    </script>

}